<?php

ob_start();
include 'connect/connect.php';
$result = mysql_query("SELECT * FROM tbl_lop where f_trangthai=0 order by f_malop DESC") or die(mysql_error());
$sotien = 0;
echo "<table border='1' style='border-collapse: collapse' width='900'>";
echo '<td width="30" bgcolor="#D6E0D8">ID</td>
<td width="170" bgcolor="#D6E0D8">Tên lớp</td>
<td width="170" bgcolor="#D6E0D8">Loại hình</td>
<td width="170" bgcolor="#D6E0D8">Ngày bắt dầu</td>
<td width="270" bgcolor="#D6E0D8">Địa điểm học</td>
<td width="240" bgcolor="#D6E0D8">Phòng học</td>
<td width="100" bgcolor="#D6E0D8">Số lượng</td>
<td width="100" bgcolor="#D6E0D8">Chi tiết</td>
';
$count=0;
$luong=0;
while ($row = mysql_fetch_array($result)) {
  if ($row['f_lop'] != 'none') {
    $count = mysql_query("SELECT * FROM tbl_thuphieu WHERE f_lop='{$row['f_lop']}'") 
or die(mysql_error()); 
    $luong=mysql_num_rows($count);
    echo "<tr>";
     
    echo "<td>" . $row['f_malop'] . "</td>";
    echo "<td>" . $row['f_lop'] . "</td>";
    echo "<td>" . $row['f_loaihinh'] . "</td>";
    echo "<td>" . $row['f_ngaybatdau'] . "</td>";
    echo "<td>" . $row['f_diadiemhoc'] . "</td>";
    echo "<td>" . $row['f_phonghoc'] . "</td>";
    echo "<td>" . $luong . "</td>";
    echo "<td><a href=hocvientronglop.php?name=".$row['f_lop'	].">Học viên</a></td>";
    
  }
}

echo "</table>";
echo "<p>";
echo 'Hom nay la ' . date("d-m-y");
?>